package cn.xf;

import java.time.Clock;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;

public class TimeJdk8 {

    public static void main(String[] args) {
        LocalDateTime lo = LocalDateTime.now();
        int year = lo.getYear();
        System.out.println(year);
        int monthValue = lo.getMonthValue();
        System.out.println(monthValue);

        Calendar.getInstance().getTimeInMillis();
        long l = System.currentTimeMillis();
        System.out.println(l);
        Clock clock = Clock.systemDefaultZone();
        System.out.println(clock.millis());


        LocalDateTime loca = LocalDateTime.now();
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
        System.out.println(loca.format(dateTimeFormatter));
    }
}
